unit UModule_Laporan_Keuangan;

interface

uses
  XSBuiltIns,
  Dialogs,
  SysUtils,
  Classes,
  InvokeRegistry,
  Rio,
  SOAPHTTPClient,
  ActnList;

type
  TModule_Laporan_Keuangan = class(TDataModule)
    ActionList1: TActionList;
    HTTPRIO1: THTTPRIO;
    PFile_Refresh_SPP: TAction;
    PMenu_Laporan_SPP: TAction;
    PMenu_Laporan_UangPembangunan: TAction;
    PFile_Refresh_UangPembangunan: TAction;
    PMenu_Laporan_BeaSiswa: TAction;
    PFile_Refresh_BeaSiswa: TAction;
    PFile_Refresh_Penerimaan: TAction;
    PFile_Refresh_Pengeluaran: TAction;
    PMenu_Laporan_Penerimaan: TAction;
    PMenu_Laporan_Pengeluaran: TAction;
    procedure HTTPRIO1AfterExecute(const MethodName: string; SOAPResponse: TStream);
    procedure PMenu_Laporan_SPPExecute(Sender: TObject);
    procedure PFile_Refresh_SPPExecute(Sender: TObject);
    procedure PFile_Refresh_UangPembangunanExecute(Sender: TObject);
    procedure PMenu_Laporan_UangPembangunanExecute(Sender: TObject);
    procedure PFile_Refresh_BeaSiswaExecute(Sender: TObject);
    procedure PMenu_Laporan_BeaSiswaExecute(Sender: TObject);
    procedure PMenu_Laporan_PenerimaanExecute(Sender: TObject);
    procedure PMenu_Laporan_PengeluaranExecute(Sender: TObject);
    procedure PFile_Refresh_PenerimaanExecute(Sender: TObject);
    procedure PFile_Refresh_PengeluaranExecute(Sender: TObject);
  private
    procedure Assign_LoginInfo;
  public
    procedure Assign_Action;
  end;

var
  Module_Laporan_Keuangan: TModule_Laporan_Keuangan;

implementation

uses
  UMainApplication,
  UUser,
  soap_sis_laporan_keuangan;
{$R *.dfm}

procedure TModule_Laporan_Keuangan.Assign_Action;
begin
try
  with Form_Main do
    begin
    TMB0105010601100101.Action := PFile_Refresh_SPP;
    TMB0105010601110101.Action := PFile_Refresh_UangPembangunan;
    TMB0105010601120101.Action := PFile_Refresh_BeaSiswa;
    TMB0105010601130101.Action := PFile_Refresh_Penerimaan;
    TMB0105010601140101.Action := PFile_Refresh_Pengeluaran;
    with CB010501 do
      begin
      with Categories[7] do
        begin
        Items[0].Action := PMenu_Laporan_SPP;
        Items[1].Action := PMenu_Laporan_UangPembangunan;
        Items[2].Action := PMenu_Laporan_BeaSiswa;
        Items[3].Action := PMenu_Laporan_Penerimaan;
        Items[4].Action := PMenu_Laporan_Pengeluaran;
        end;
      end;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.Assign_LoginInfo;
begin
try
  with Form_Main do
    begin
    GServer_Host     := IN010301.Text;
    GServer_Database := IN010302.Text;
    GServer_UserName := IN010303.Text;
    GServer_Password := IN010304.Text;
    GUserName        := LE01010101.Text;
    GUserPassword    := LE01010102.Text;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.HTTPRIO1AfterExecute(const MethodName: string; SOAPResponse: TStream);
var
  LocalStrings: TStringList;
begin
try
  LocalStrings          := TStringList.Create;
  SOAPResponse.Position := 0;
  LocalStrings.LoadFromStream(SOAPResponse);
  // ShowMessage(LocalStrings.Text);
  FreeAndNil(LocalStrings);
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PFile_Refresh_BeaSiswaExecute(Sender: TObject);
var
  DataServer:           TInfoServer;
  LocalLaporanBeaSiswa: TLaporanBeaSiswa;
  LocalCount:           Integer;
  LocalIndex:           word;
begin
try
  Assign_LoginInfo;
  DataServer                 := TInfoServer.Create;
  DataServer.Server_Host     := GServer_Host;
  DataServer.Server_Database := GServer_Database;
  DataServer.Server_Username := GServer_UserName;
  DataServer.Server_Password := GServer_Password;
  with Form_Main, HTTPRIO1 as SERVICE_LAPORAN_KEUANGANPortType do
    begin
    LAPORAN_BEASISWA(DataServer, LocalLaporanBeaSiswa);
    LocalCount := high(LocalLaporanBeaSiswa) + 1;
    if LocalCount > 0 then
      begin
      with Grid01050106011201 do
        begin
        BeginUpdate;
        ClearRows;
        AddRow(LocalCount);
        for LocalIndex := 0 to LocalCount - 1 do
          begin
          Cell[1, LocalIndex].AsInteger  := LocalLaporanBeaSiswa[LocalIndex].ID;
          Cell[2, LocalIndex].AsString   := LocalLaporanBeaSiswa[LocalIndex].SISWA_KODE;
          Cell[3, LocalIndex].AsString   := LocalLaporanBeaSiswa[LocalIndex].SISWA_NAMA_AWAL;
          Cell[4, LocalIndex].AsString   := LocalLaporanBeaSiswa[LocalIndex].SISWA_KELAS;
          Cell[5, LocalIndex].AsDateTime := LocalLaporanBeaSiswa[LocalIndex].BEASISWA_TGL.AsDateTime;
          Cell[6, LocalIndex].AsFloat    := LocalLaporanBeaSiswa[LocalIndex].BEASISWA_NILAI;
          Cell[7, LocalIndex].AsString   := LocalLaporanBeaSiswa[LocalIndex].BEASISWA_KETERANGAN;
          end;
        EndUpdate;
        end;
      end;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PFile_Refresh_PenerimaanExecute(Sender: TObject);
var
  DataServer:             TInfoServer;
  LocalLaporanPenerimaan: TLaporanPenerimaan;
  LocalCount:             Integer;
  LocalIndex:             word;
begin
try
  Assign_LoginInfo;
  DataServer                 := TInfoServer.Create;
  DataServer.Server_Host     := GServer_Host;
  DataServer.Server_Database := GServer_Database;
  DataServer.Server_Username := GServer_UserName;
  DataServer.Server_Password := GServer_Password;
  with Form_Main, HTTPRIO1 as SERVICE_LAPORAN_KEUANGANPortType do
    begin
    LAPORAN_PENERIMAAN(DataServer, LocalLaporanPenerimaan);
    LocalCount := high(LocalLaporanPenerimaan) + 1;
    if LocalCount > 0 then
      begin
      with Grid01050106011301 do
        begin
        BeginUpdate;
        ClearRows;
        AddRow(LocalCount);
        for LocalIndex := 0 to LocalCount - 1 do
          begin
          Cell[1, LocalIndex].AsInteger  := LocalLaporanPenerimaan[LocalIndex].ID;
          Cell[2, LocalIndex].AsString   := LocalLaporanPenerimaan[LocalIndex].USER_NAME;
          Cell[3, LocalIndex].AsString   := LocalLaporanPenerimaan[LocalIndex].USER_NAMA_AWAL;
          Cell[4, LocalIndex].AsString   := LocalLaporanPenerimaan[LocalIndex].USER_OTORISASI;
          Cell[5, LocalIndex].AsString   := LocalLaporanPenerimaan[LocalIndex].PENERIMAAN_JENIS;
          Cell[6, LocalIndex].AsDateTime := LocalLaporanPenerimaan[LocalIndex].PENERIMAAN_TGL.AsDateTime;
          Cell[7, LocalIndex].AsFloat    := LocalLaporanPenerimaan[LocalIndex].PENERIMAAN_NILAI;
          Cell[8, LocalIndex].AsString   := LocalLaporanPenerimaan[LocalIndex].PENERIMAAN_KETERANGAN;
          end;
        EndUpdate;
        end;
      end;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PFile_Refresh_PengeluaranExecute(Sender: TObject);
var
  DataServer:              TInfoServer;
  LocalLaporanPengeluaran: TLaporanPengeluaran;
  LocalCount:              Integer;
  LocalIndex:              word;
begin
try
  Assign_LoginInfo;
  DataServer                 := TInfoServer.Create;
  DataServer.Server_Host     := GServer_Host;
  DataServer.Server_Database := GServer_Database;
  DataServer.Server_Username := GServer_UserName;
  DataServer.Server_Password := GServer_Password;
  with Form_Main, HTTPRIO1 as SERVICE_LAPORAN_KEUANGANPortType do
    begin
    LAPORAN_PENGELUARAN(DataServer, LocalLaporanPengeluaran);
    LocalCount := high(LocalLaporanPengeluaran) + 1;
    if LocalCount > 0 then
      begin
      with Grid01050106011401 do
        begin
        BeginUpdate;
        ClearRows;
        AddRow(LocalCount);
        for LocalIndex := 0 to LocalCount - 1 do
          begin
          Cell[1, LocalIndex].AsInteger  := LocalLaporanPengeluaran[LocalIndex].ID;
          Cell[2, LocalIndex].AsString   := LocalLaporanPengeluaran[LocalIndex].USER_NAME;
          Cell[3, LocalIndex].AsString   := LocalLaporanPengeluaran[LocalIndex].USER_NAMA_AWAL;
          Cell[4, LocalIndex].AsString   := LocalLaporanPengeluaran[LocalIndex].USER_OTORISASI;
          Cell[5, LocalIndex].AsString   := LocalLaporanPengeluaran[LocalIndex].PENGELUARAN_JENIS;
          Cell[6, LocalIndex].AsDateTime := LocalLaporanPengeluaran[LocalIndex].PENGELUARAN_TGL.AsDateTime;
          Cell[7, LocalIndex].AsFloat    := LocalLaporanPengeluaran[LocalIndex].PENGELUARAN_NILAI;
          Cell[8, LocalIndex].AsString   := LocalLaporanPengeluaran[LocalIndex].PENGELUARAN_KETERANGAN;
          end;
        EndUpdate;
        end;
      end;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PFile_Refresh_SPPExecute(Sender: TObject);
var
  DataServer:      TInfoServer;
  LocalLaporanSPP: TLaporanSPP;
  LocalCount:      Integer;
  LocalIndex:      word;
begin
try
  Assign_LoginInfo;
  DataServer                 := TInfoServer.Create;
  DataServer.Server_Host     := GServer_Host;
  DataServer.Server_Database := GServer_Database;
  DataServer.Server_Username := GServer_UserName;
  DataServer.Server_Password := GServer_Password;
  with Form_Main, HTTPRIO1 as SERVICE_LAPORAN_KEUANGANPortType do
    begin
    LAPORAN_SPP(DataServer, LocalLaporanSPP);
    LocalCount := high(LocalLaporanSPP) + 1;
    if LocalCount > 0 then
      begin
      with Grid01050106011001 do
        begin
        BeginUpdate;
        ClearRows;
        AddRow(LocalCount);
        for LocalIndex := 0 to LocalCount - 1 do
          begin
          Cell[1, LocalIndex].AsInteger  := LocalLaporanSPP[LocalIndex].ID;
          Cell[2, LocalIndex].AsString   := LocalLaporanSPP[LocalIndex].SISWA_KODE;
          Cell[3, LocalIndex].AsString   := LocalLaporanSPP[LocalIndex].SISWA_NAMA_AWAL;
          Cell[4, LocalIndex].AsString   := LocalLaporanSPP[LocalIndex].SISWA_KELAS;
          Cell[5, LocalIndex].AsDateTime := LocalLaporanSPP[LocalIndex].SPP_TGL.AsDateTime;
          Cell[6, LocalIndex].AsFloat    := LocalLaporanSPP[LocalIndex].SPP_NILAI;
          Cell[7, LocalIndex].AsString   := LocalLaporanSPP[LocalIndex].SPP_KETERANGAN;
          end;
        EndUpdate;
        end;
      end;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PFile_Refresh_UangPembangunanExecute(Sender: TObject);
var
  DataServer:                  TInfoServer;
  LocalLaporanUangPembangunan: TLaporanUangPembangunan;
  LocalCount:                  Integer;
  LocalIndex:                  word;
begin
try
  Assign_LoginInfo;
  DataServer                 := TInfoServer.Create;
  DataServer.Server_Host     := GServer_Host;
  DataServer.Server_Database := GServer_Database;
  DataServer.Server_Username := GServer_UserName;
  DataServer.Server_Password := GServer_Password;
  with Form_Main, HTTPRIO1 as SERVICE_LAPORAN_KEUANGANPortType do
    begin
    LAPORAN_UANGPEMBANGUNAN(DataServer, LocalLaporanUangPembangunan);
    LocalCount := high(LocalLaporanUangPembangunan) + 1;
    if LocalCount > 0 then
      begin
      with Grid01050106011101 do
        begin
        BeginUpdate;
        ClearRows;
        AddRow(LocalCount);
        for LocalIndex := 0 to LocalCount - 1 do
          begin
          Cell[1, LocalIndex].AsInteger  := LocalLaporanUangPembangunan[LocalIndex].ID;
          Cell[2, LocalIndex].AsString   := LocalLaporanUangPembangunan[LocalIndex].SISWA_KODE;
          Cell[3, LocalIndex].AsString   := LocalLaporanUangPembangunan[LocalIndex].SISWA_NAMA_AWAL;
          Cell[4, LocalIndex].AsString   := LocalLaporanUangPembangunan[LocalIndex].SISWA_KELAS;
          Cell[5, LocalIndex].AsDateTime := LocalLaporanUangPembangunan[LocalIndex].UANGPEMBANGUNAN_TGL.AsDateTime;
          Cell[6, LocalIndex].AsFloat    := LocalLaporanUangPembangunan[LocalIndex].UANGPEMBANGUNAN_NILAI;
          Cell[7, LocalIndex].AsString   := LocalLaporanUangPembangunan[LocalIndex].UANGPEMBANGUNAN_KETERANGAN;
          end;
        EndUpdate;
        end;
      end;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PMenu_Laporan_BeaSiswaExecute(Sender: TObject);
begin
try
  with Form_Main, TAB010501060112 do
    begin
    Show;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PMenu_Laporan_PenerimaanExecute(Sender: TObject);
begin
try
  with Form_Main, TAB010501060113 do
    begin
    Show;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PMenu_Laporan_PengeluaranExecute(Sender: TObject);
begin
try
  with Form_Main, TAB010501060114 do
    begin
    Show;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PMenu_Laporan_SPPExecute(Sender: TObject);
begin
try
  with Form_Main, TAB010501060110 do
    begin
    Show;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

procedure TModule_Laporan_Keuangan.PMenu_Laporan_UangPembangunanExecute(Sender: TObject);
begin
try
  with Form_Main, TAB010501060111 do
    begin
    Show;
    end;
except
  on E: Exception do
    begin
    ShowMessage(E.Message);
    end;
end;
end;

end.
